package cn.shyouchi.wuguanjia.android.ui.event.report;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/11/18 at 12:36
 * Email: 472279981@qq.com
 * Des:
 */

public class ReportTimeAdapter extends BaseQuickAdapter<String,BaseViewHolder> {

    boolean isEdit = true;

    public ReportTimeAdapter(List<String> data, boolean isEdit) {
        super(R.layout.item_event_report_time_layout, data);
        this.isEdit = isEdit;
    }

    public ReportTimeAdapter(List<String> data) {
        super(R.layout.item_event_report_time_layout, data);
        isEdit = true;
    }

    @Override
    protected void convert(BaseViewHolder holder, final String s) {
        holder.setText(R.id.tv_report_time, s);
        if (!isEdit) {
            holder.getView(R.id.btn_del_time).setVisibility(View.INVISIBLE);
        }
        holder.getView(R.id.btn_del_time).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getData().remove(s);
                notifyDataSetChanged();
            }
        });
    }
}
